home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1223 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  57 lines

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Locaton of an array?
  5. Date: 12 Jan 1996 06:06:27 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Jan11230627@qcd.lanl.gov>
  8. References: <4d4iqk$hs3@overload.lbl.gov> <maverickDL1u3x.45I@netcom.com>
  9. NNTP-Posting-Host: qcd.lanl.gov
  10. Mime-Version: 1.0
  11. Content-Type: text
  12. In-reply-to: maverick@netcom.com's message of Fri, 12 Jan 1996 03:39:47 GMT
  13.  
  14. --text follows this line--
  15. In article <maverickDL1u3x.45I@netcom.com> maverick@netcom.com (Chris
  16. Shepard) writes: 
  17. <snip>
  18.    #include <the usual stuff>
  19. undefined behavious :-)
  20.  
  21.    int main(void)
  22.    {
  23.        char arr[10],
  24.              *p;
  25.  
  26.        p=arr;
  27.        printf("addr of arr = %p\n",p);
  28.  
  29. undefined behaviour! make that
  30.        printf("addr of arr = %p\n",(void*)p);
  31.  
  32. (Actually with p a char*, it is a technicality: but why not write
  33. technically correct code? :-)
  34.  
  35.        return(EXIT_SUCCESS);
  36.    }
  37.  
  38.    Btw, just  out of curiosity, why do you care where it lives in
  39.    absolute RAM?
  40.  
  41. By the way, the output of %p (as also the result of the (int) cast on
  42. a pointer) is upto the implementation. C can be implemented on machines
  43. which have no natural mapping onto a flat address space, so the
  44. original question may not have a definite meaning. An answer to the
  45. `why' that you ask is definitely required before more help can be
  46. provided. 
  47.  
  48. Cheers
  49. Tanmoy
  50. --
  51. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  52. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  53. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  54. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  55. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  56. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  57.